public class Computer {
    private String name;
    private double price;
    private CPU cpu;
    private RAM ram;
    private HardDisk hardDisk;
    private Motherboard motherboard;

    Computer(String name,CPU cpu,RAM ram,HardDisk hardDisk,Motherboard motherboard){
        this.name = name;
        this.cpu = cpu;
        this.ram = ram;
        this.hardDisk = hardDisk;
        this.motherboard = motherboard;
        this.price = cpu.getPrice()+ram.getPrice()+hardDisk.getPrice()+motherboard.getPrice();
    }

    public String getName() { return name; }
    public double getPrice() { return price; }

    public void description(){
        String cpu_name = this.cpu.getName();
        String ram_name = this.ram.getName();
        String hardDisk_name = this.hardDisk.getName();
        String motherBoard_name = this.motherboard.getName();
        System.out.println("The "+this.name+" computer has components: "
                +cpu_name+","+ram_name+","+hardDisk_name
                +","+motherBoard_name+", total price is "+this.getPrice());
    }
}
